package com.example.farm.mapper;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.example.farm.Bean.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.ArrayList;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 姚
 * @since 2023-04-15
 */
@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    //增
    @Override
    int insert(Product product);

    //改
    @Update("update product set Quantity = #{Quantity} where uid = #{uid}")
    int update(Product product, UpdateWrapper<Product> updateWrapper);

    //删
    //查出所有的商品
    @Select("select * from product")
    ArrayList<Product> selectAll();

}
